#include "FileBuffer.hpp"

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

#ifndef STRICT
#define STRICT
#endif

#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif

#include <windows.h>

namespace Pdf
{
	FileBuffer::FileBuffer()
		: m_data(NULL)
		, m_size(0)
	{
		SYSTEM_INFO si = { 0 };
		::GetSystemInfo(&si);
		m_size = si.dwPageSize * 16;
		m_data = static_cast<char *>(::VirtualAlloc(NULL, m_size, MEM_COMMIT, PAGE_READWRITE));
	}

	FileBuffer::~FileBuffer()
	{
		::VirtualFree(m_data, 0, MEM_RELEASE);
	}

	char * FileBuffer::data() const
	{
		return m_data;
	}

	size_t FileBuffer::size() const
	{
		return m_size;
	}
}